<HTML>
  <HEAD>
    <link rel="stylesheet" type="text/css" href="table.css"/>
    <SCRIPT>
      function checkpass(){
        if (document.getElementById("pass").value == "12345"){
          document.getElementById("hidepanel").innerHTML = 
            "<input type='radio' id='ok' name='set' value='&#49444;&#51221;' checked='checked'>&#49444;&#51221;&nbsp;&nbsp;&nbsp;" +
            "<input type='radio' id='no' name='set' value='&#54644;&#51228;'>&#54644;&#51228;<br>" +
            "<center><input type='button' id='chkok' value='&#54869;&#51064;' onclick='javascript:setting();'></center>";
        }
        else{
          document.getElementById("hidepanel").innerHTML = "";
        }
      }
      
      function clearpass(){
        document.getElementById("hidepanel").innerHTML = "";
        document.getElementById("pass").value = "";
      }
      
      function setting(){
        if (document.getElementById("ok").checked){
          window.location = "setting.php?id=1";
        }
        else{
          window.location = "setting.php?id=0";
        }
      }
    </SCRIPT>
  </HEAD>
  <BODY>
    <TABLE BORDER="0">
    <thead>
	    <tr>
	       <th id="fn" scope="col">&#48372;&#50504; &#47784;&#46300;</th>
	    </tr>
	  </thead>
	  <tr>
	    <?php
	      $con = mysql_connect("mysql1.000webhost.com", "a7424976_info", "thebest5");
      	$res = mysql_select_db("a7424976_info");
      	
      	$queryres = mysql_query("select * from security");
      	
      	$row = mysql_fetch_row($queryres);
        $arr = array("imgs/unlocked.png", "imgs/locked.png");
	    ?>
      <th scope="row">
        <img src = "<? echo $arr[$row[0]]; ?>" width="75" height="100">
        <?php
          if (!strcmp($row[0], "0")){
            echo "&#48372;&#50504; &#47784;&#46300; Off";
          }
          else{
            echo "&#48372;&#50504; &#47784;&#46300; On";
          }
        ?>
      </th>
    </tr>
    <tr>
      <th scope="row">
        &#48708;&#48128; &#48264;&#54840;&#47484; &#51077;&#47141;&#54616;&#49464;&#50836;.<br>
        <input type="password" id="pass"><br>
        <input type="submit" name="submit" value="&#54869;&#51064;" onclick="javascript:checkpass();">&nbsp;&nbsp;&nbsp;
        <input type="submit" name="rewrite" value="&#45796;&#49884; &#51077;&#47141;" onclick="javascript:clearpass();">
      </th>
    </tr>
    <tr>
      <th scope="row">
        <div id="hidepanel"></div>
      </th>
    </tr>
  </TABLE>
  </BODY>
</HTML>